import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { lotrecordVO, lotrecordForm, lotrecordQuery } from '@/api/parkinglot/lotRecord/types';

/**
 * 查询停车记录列表
 * @param query
 * @returns {*}
 */

export const listlotrecord = (query?: lotrecordQuery): AxiosPromise<lotrecordVO[]> => {
  return request({
    url: '/parkinglot/lotRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询停车记录详细
 * @param parkingLotRecordId
 */
export const getlotrecord = (parkingLotRecordId: string | number): AxiosPromise<lotrecordVO> => {
  return request({
    url: '/parkinglot/lotRecord/' + parkingLotRecordId,
    method: 'get'
  });
};

/**
 * 新增停车记录
 * @param data
 */
export const addlotrecord = (data: lotrecordForm) => {
  return request({
    url: '/parkinglot/lotRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改停车记录
 * @param data
 */
export const updatelotrecord = (data: lotrecordForm) => {
  return request({
    url: '/parkinglot/lotRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除停车记录
 * @param parkingLotRecordId
 */
export const dellotrecord = (parkingLotRecordId: string | number | Array<string | number>) => {
  return request({
    url: '/parkinglot/lotRecord/' + parkingLotRecordId,
    method: 'delete'
  });
};
